package com.gzh.core.chche.service;

import com.gzh.core.chche.config.CacheConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CacheManage implements ICacheManage {
    @Autowired
    private SchoolCache schoolCache;
    @Autowired
    private UserCache userCache;
    @Autowired
    private CacheConfig cacheConfig;


    @Override
    public void init() {
        if ("true".equals(this.cacheConfig.getSchoolCache()))
            schoolCache.init();
        if ("true".equals(this.cacheConfig.getUserCache()))
            userCache.init();
    }

    @Override
    public SchoolCache getSchoolCache() {
        return schoolCache;
    }

    @Override
    public UserCache getUserCache() {
        return userCache;
    }
}
